package com.cbx.dao;

import java.util.List;

import com.dao.ObjectDao;

import com.pro.bean.Visit_View;

public class VisitDao extends ObjectDao {
	public List find(String cmp, String firstname,
			String username, String visittime1,String visittime2) {
		String sql = "select *from Visit_View where 1=1 ";
		if (cmp != null && !cmp.equals("")) {
			sql += " and Visit_View.cmp='" + cmp+"'";
		}
		if (firstname != null && !firstname.equals("")) {
			sql+=" and Visit_View.firstname='"+firstname+"'";
		}
		if (username != null && !username.equals("")) {
			sql+=" and Visit_View.username= '"+username+"'";
		}

		if (visittime1 != null && !visittime1.equals(""))
	{
			if(visittime2 != null && !visittime2.equals(""))
		{
			sql+="and Visit_View.visittime between '"+visittime1+"' and '"+visittime2+"'";
			}
		}	

		System.out.println("cbx sql->"+sql);
		return super.findAll(sql, new Visit_View());
	}
}
